package edu.nf.webapp.service;

import edu.nf.webapp.common.exception.LoginException;
import edu.nf.webapp.dao.UserDao;
import edu.nf.webapp.entity.User;

/**
 * @author wangl
 * @date 2024/5/21
 */
public class LoginService {

    public User auth(String account, String password) {
        UserDao dao = new UserDao();
        User user = dao.getUserByAccount(account);
        if (user != null) {
            if (password.equals(user.getPassword())) {
                return user;
            }
        }
        throw new LoginException(10001, "账号或密码错误");
    }
}